import request from "@/plugins/axios";

/**
 * 分页查询资产登记记录
 * @param searchKeyword
 * @param currentPage
 * @param pageSize
 */
export function searchRegistrationList(params) {
    return request({
        url: "/api/asset/registration/page",
        method: "get",
        params: params
    });
}

/**
 * 添加资产登记记录
 * @param formData
 */
export function addRegistration(formData) {
    return request({
        url: "/api/asset/registration",
        method: "post",
        data: formData
    });
}

/**
 * 校验项目名称唯一性
 * @param path
 */
export function validatorProjectNameByAdd(projectName) {
    return request({
        url: "/api/asset/registration/check-projectName-add/" + projectName,
        method: "get"
    });
}

/**
 * 校验项目名称唯一性(修改时)
 * @param path
 */
export function validatorProjectNameByUpdate(projectName, assetRegistrationId) {
    return request({
        url:
            "/api/asset/registration/check-projectName-update?projectName=" +
            projectName +
            "&assetRegistrationId=" +
            assetRegistrationId,
        method: "get"
    });
}

/**
 * 删除资产登记记录
 * @param val
 */
export function deleteRowById(val) {
    return request({
        url: "/api/asset/registration/" + val,
        method: "delete"
    });
}

/**
 * 查询资产登记记录
 * @param id
 */
export function getRegistration(id) {
    return request({
        url: "/api/asset/registration/" + id,
        method: "get"
    });
}

/**
 * 更新资产登记记录
 * @param editObj
 */
export function updateRegistration(editObj) {
    return request({
        url: "/api/asset/registration/",
        method: "put",
        data: editObj
    });
}

/**
 * 导出资产登记记录
 * @param searchKeyword
 * @param currentPage
 * @param pageSize
 */
export function exportRegistration(params) {
    return request({
        url: "/api/asset/registration/export",
        method: "get",
        params,
        responseType: "blob"
    });
}

/**
 * 发送消息
 * @param formData
 */
export function sendMessage(SysInfoSendDto) {
    return request({
        url: "/api/sysinfo/sendMsg",
        method: "post",
        data: SysInfoSendDto
    });
}

/**
 * 查询所有的部门
 */
export function getDept() {
    return request({
        url: "/api/rentproperty/getAllDept",
        method: "get"
    });
}

/**
 * 根据部门获取人员
 */
export function getDeptUser(deptIdList) {
    return request({
        url: "/api/rentproperty/getUser",
        method: "post",
        data: deptIdList
    });
}

/**
 * ocr文件上次
 * @param obj
 */
export function uploadContractFile(obj) {
    return request({
        url: "/admin/sys-file/upload",
        method: "post",
        data: obj
    });
}

/**
 * 导出政府投资项目表格
 * @param searchKeyword
 * @param currentPage
 * @param pageSize
 */
export function exportWord(assetRegistrationId) {
    return request({
        url: "/api/asset/registration/download/registration?assetRegistrationId="+assetRegistrationId,
        method: "get",
        responseType: "blob"
    });
}
